import * as Cesium from 'cesium';
import * as Libora from '../../public/libora/index.js'

export class HelperLib {
  static getAxex(options) {
    return new Libora.AxesHelper({
      viewer: options.viewer,
      target: options.target,
      scale: options.scale || 0.5,
      type: options.type || Libora.AxesHelperType.GLOBE,
      coordinateSystem: options.coordinateSystem || Libora.CoordinateSystem.ENU,
      ...options
    });
  }

  /**
   *
   * @param {*} viewer
   * @param {*} options
   * @returns
   * @example
   * ```js
   * var helper;
   *  setInterval(() => {
      if (helper) {
        helper.dispose()
        helper = null;
      }

      const sunDir = viewer.scene.context.uniformState.sunDirectionWC;
      helper = HelperLib.getVectorHelper(viewer, {
        position: position,
        direction: sunDir,
        // direction: new Cesium.Cartesian3(1, 0, 0),
        length: 10000000,
        color: "#ffff00"
      })
    }, 100);
   * ```
   */
  static getVectorHelper(viewer, options) {
    return new Libora.VectorHelper({
      viewer,
      position: options.position,
      length: options.length||500000,
      width: options.width||10000,
      direction: options.direction,
      color: options.color || "#ff0000"
    })
  }
}
